repo: Fix object list keys ownership
authorDan Nicholson <nicholson@endlessm.com>
Wed, 21 Dec 2016 11:59:08 +0000 (05:59 -0600)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 22 Dec 2016 16:07:52 +0000 (16:07 +0000)
commitdd3cda401beed444ff2229f1c56e74b2b9fa922e
tree0e311288478a7b19caccccd42d8117e2f8dc216d
parent169a629345ccf42d211005c38e98a246c3f87e21
repo: Fix object list keys ownership

ostree_object_name_serialize returns a floating ref, so sink it before
adding it to the hash table so it can properly be freed later when the
hash table is destroyed.

This is particularly a problem for pygobject, which sinks the refs on
variants as it marshals them to native python types. If the ref isn't
already sunk, then the ref count won't increase and a critical warning
will be raised when both the hash table and pygobject try to unref it.

Closes: #635
Approved by: cgwalters
src/libostree/ostree-repo.c